programming4us
           
 
 
Applications Server

Microsoft Systems Management Server 2003 : Modifying Installation Scripts Using Script Editor (part 1) - Script Editor Variables and Actions

- Free product key for windows 10
- Free Product Key for Microsoft office 365
- Malwarebytes Premium 3.7.1 Serial Keys (LifeTime) 2019
6/21/2012 4:51:14 PM
As we’ve seen, we can use SMS Installer’s graphical menus and attribute settings to configure our installation scripts to suit our specific needs. Under different circumstances, however, these tools might not give us all the control needed to fully customize our SMS Installer–generated script file. Likewise, specific situations might arise in which it’s more efficient or just faster and easier to use a scripting method to make changes.

It really doesn’t matter how we go about creating our scripted installation. Remember, we can generate our initial script using either the Repackage Installation Wizard or the Watch Application Wizard. These two methods are probably preferred, as they give us a good basic script that we can customize using the Script Editor utility. Or we can open the Script Editor interface to modify an existing script or even begin scripting from scratch. In this section we’ll explore Script Editor variables and actions and then look at how to modify installation scripts using Script Editor.

Script Editor Variables and Actions

The Script Editor provided by SMS Installer is a powerful scripting utility. It provides a vast array of variables and actions (SMS Installer commands) that let you optimize the script files used by the installation process. Script variables contain information about the installation being performed. We can use these variables to hold the information gathered from users about where to place files. Script variables can also be used to hold information about which files users want to install. Additionally, a number of predefined variables contain information about the target computer system on which you’re installing software.

Before we look at how to make modifications to a script using Script Editor, let’s review some common scripting variables and actions. The following tables aren’t intended as a comprehensive list of all the available variables and actions, but rather as a short list of those more commonly used.

More Info

Refer to the SMS Installer Help for a comprehensive list of scripting variables and actions.


Table 1 lists several predefined variables and the values they are designed to return.

Table 1. Predefined variables
VariableReturns
WINThe path of the Windows directory—for example, C:\Windows.
SYS32The system directory for Win32 files under Windows NT and higher—for example, C:\Winnt\System32.
TEMPThe path of the temporary directory on the reference computer. An application often uses this directory to store DLLs before referencing them.
CMDLINEThe command-line options that are passed to the SMS Installer–generated file.
PASSWORDThe installation password assigned to a password-protected installation.

As we write our script, we can have SMS assign values to existing variables or generate additional variables to perform functions or hold values. During the installation, we can create the variables SMS uses to perform various functions. For example, we can define the values for the four variables listed in Table 2 as part of the installation script or have SMS prompt for the values during execution of the installation script. SMS frequently uses these variables—note especially the DOBACKUP variable, which is used to support the SMS Installer rollback feature.

Table 2. Functional variables
VariableFunction
BACKUPDIRDefines where the backup files should be located.
DOBACKUPEnables the performance of a backup of all files replaced during an installation.
HELPFILEIdentifies the help file to be read and displayed during installation when the user clicks Help.
RESTARTCauses the system to be restarted when the script terminates. This variable is generally set automatically.

Defining Variables

As mentioned, you can also define your own variables in the script. You can use the Set Variable action or the Prompt For Text action from Script Editor. To create variables, follow these steps:

1.
In the Installation Expert interface, choose Script Editor from the View menu to display the Script Editor interface, shown in Figure 1.

Figure 1. The Script Editor interface.

Note

If you previously closed SMS Installer from the Script Editor interface, when you next open SMS Installer, Script Editor appears with the Installation Script pane blank. If you open SMS Installer in the Installation Expert interface, it loads a default script, which is displayed in the Installation Script screen when you switch to Script Editor.

2.
In the Actions list, double-click the Set Variable action to display the Set Variable dialog box, shown in Figure 2.

Figure 2. The Set Variable dialog box.


3.
Enter the name of the variable you want to create or select a variable to modify from the Variable drop-down list. Variable names must always begin with a letter, must be no longer than 14 characters, and must contain no special characters except underscores.

4.
In the New Value text box, enter the value you want to set the variable to.

5.
Select an operation that you want performed on the new value from the Operation drop-down list, if required. Operations include incrementing or decrementing a numeric value by 1, removing trailing backslashes, converting a value to all uppercase or lowercase, converting the path and filename to a short or long filename, or simply performing no action—the default.

More Info

Refer to the SMS Installer Help for examples of how to use the different operations.

6.
Three check boxes appear at the bottom of the Set Variable dialog box: Append To Existing Value, Remove Filename, and Read Variable From Values File. If the variable you entered is a counter and you choose to increment or decrement its value, select the Append To Existing Value check box. You can also use this option to append a string value to the current string value. If you want to remove the filename from a value that has a full path, select the Remove Filename check box. If you want SMS Installer to read the variable’s value from a file, select the Read Variable From Values File select box. Selecting this option will cause the entered value to be ignored, so select this option only if you’re running your script from the command line.

7.
Click OK to close the Set Variable dialog box.

To create a variable named APPDIR, for example, in which you set the location of the application’s working directory, enter APPDIR as the variable name and an appropriate path such as C:\TechNet as the value. When you need to invoke this value in your script, reference the variable’s value by enclosing the variable name in percent signs. To create a BACKUP directory for rollback that’s a subdirectory of the path you entered for APPDIR, your script line would look like this:

Set Variable BACKUP to %APPDIR%\BACKUP

Set Variable is just one of the SMS Installer Script Editor actions. In the next section we’ll look at the more common Script Editor actions.

Common Script Editor Actions

The Script Editor window, shown in Figure 1, contains a list of SMS Installer Script Editor actions that the installation script can perform. In this section we’ll look at some of the more common actions and their functions. Table 3 lists these actions.

Table 3. SMS Installer Script Editor actions
ActionDescription
Add to AUTOEXEC.BATAdds or replaces commands and environment variables in the Autoexec.bat file other than the PATH command.
Add to CONFIG.SYSAdds device driver and other statements to the Config.sys file.
Call DLL FunctionCalls specific Win16 and Win32 DLLs.
Check Disk SpacePerforms a check of disk space to verify that there’s enough free space to complete the installation.
Check If File/Dir ExistsChecks whether a specified file or directory exists on the target computer.
Create DirectoryCreates a new directory on the target computer.
Create ServiceCreates a service on a target Windows computer.
Delete File(s)Deletes specified files and directories from the target computer.
Edit RegistryCreates or deletes new keys and values in the registry on Windows 95 or later computers.
Else StatementInserts a logical ELSE statement into the script.
Execute ProgramCalls an executable to run outside the actual scripted installation.
Exit InstallationTerminates and exits the installation.
If/While StatementInserts IF/WHILE logic into the script.
Install File(s)Finds the source files used during installation and compresses them into the installer executable file. These files are uncompressed on the target computer when the script is run.
Prompt For TextGenerates a dialog box to prompt the user for text input such as a filename or directory path.
RemarkAdds comments to the script.
Rename File/DirectoryFinds and renames a file or directory on the target computer.
Set VariableCreates or modifies a script variable.

As you can see, variables and actions can be set in your script. You can find more details about these options in the SMS Installer Help file accessible through the SMS Installer interface. Don’t expect to become proficient at scripting in a couple of hours or even a couple of days. We’re talking about a scripting language here, and that takes time to learn and appreciate. But with a little perseverance you’ll become proficient at using many of these options.

Other -----------------
- System Center Configuration Manager 2007 : Architecture Design Planning - Site Planning
- System Center Configuration Manager 2007 : Hierarchy Planning
- Microsoft Systems Management Server 2003 : Modifying Installation Scripts Using the Installation Expert (part 2)
- Microsoft Systems Management Server 2003 : Modifying Installation Scripts Using the Installation Expert (part 1)
- Sizing Considerations for mySAP Components (part 2) - Sizing mySAP Business Intelligence & Sizing mySAP SRM
- Sizing Considerations for mySAP Components (part 1) - The SAP Exchange Infrastructure
- Active Directory Domain Services 2008 : Transfer the Infrastructure Master Role
- Active Directory Domain Services 2008 : Transfer the PDC Emulator Role
- SAP Hardware, OS, and Database Sizing
- Preparing for the SAP Sizing Process
- Microsoft Systems Management Server 2003 : Systems Management Server Installer Tools & Creating Installation Scripts
- Installing Systems Management Server Installer
- Microsoft Dynamic GP 2010 : Installing Integration Manager (part 2) - SQL Server maintenance jobs
- Microsoft Dynamic GP 2010 : Installing Integration Manager (part 1) - SQL Server and database settings
- Active Directory Domain Services 2008 : Transfer the RID Master Role
- Active Directory Domain Services 2008 : Transfer the Domain Naming Master Role
- Microsoft Dynamics AX 2009 : Working with Forms - Modifying application version
- Microsoft Dynamics AX 2009 : Working with Forms - Modifying the User setup form
- Microsoft Dynamics AX 2009 : Working with Forms - Adding a Go to the Main Table Form link
- Designing and Optimizing Storage in an Exchange Server 2007 Environment (part 4)
 
 
 
Top 10
 
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 2) - Wireframes,Legends
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 1) - Swimlanes
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Formatting and sizing lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Adding shapes to lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Sizing containers
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 3) - The Other Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 2) - The Data Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 1) - The Format Properties of a Control
- Microsoft Access 2010 : Form Properties and Why Should You Use Them - Working with the Properties Window
- Microsoft Visio 2013 : Using the Organization Chart Wizard with new data
- First look: Apple Watch

- 3 Tips for Maintaining Your Cell Phone Battery (part 1)

- 3 Tips for Maintaining Your Cell Phone Battery (part 2)
programming4us programming4us